<%--
  Created by IntelliJ IDEA.
  User: joker
  Date: 2023/4/30
  Time: 11:07
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>CoolMeeting会议管理系统管理</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/styles/common.css"/>
    <script src="${pageContext.request.contextPath}/js/node_modules/jquery/dist/jquery.js"></script>
</head>
<body>
    <div class="page-header">
        <div class="header-banner">
            <img src="${pageContext.request.contextPath}/images/header.png" alt="CoolMeeting"/>
        </div>
        <div class="header-title">
            欢迎访问Cool-Meeting会议管理系统
        </div>
        <div class="header-quicklink">
            欢迎您，<strong>${accountName}</strong>
            <a href="adminChangePassword.do">[修改密码]</a>
        </div>
    </div>
    <div class="page-body">
        <div class="page-sidebar">
            <div class="sidebar-menugroup">
                <div class="sidebar-grouptitle">人员管理</div>
                <ul class="sidebar-menu">
                    <li class="sidebar-menuitem"><a href="department.do">部门管理</a></li>
                    <li class="sidebar-menuitem"><a href="register.do">员工注册</a></li>
                    <li class="sidebar-menuitem">
                        <a href="employeeApprove.do?accountName=${accountName}&password=${emp.password}" >注册审批</a></li>
                    <li class="sidebar-menuitem"><a href="search.do">搜索员工</a></li>
                </ul>
            </div>
        </div>
    </div>
    <div class="page-content">
        <div class="content-nav">
            人员管理 > 注册审批
        </div>
        <table class="listtable">
            <caption>所有待审批注册信息：</caption>
            <tr class="listheader">
                <th>姓名</th>
                <th>账号名</th>
                <th>联系电话</th>
                <th>电子邮件</th>
                <th>操作</th>
            </tr>
            <c:forEach items="${empList}" var="emp">
                <tr id="" class="emp-no">
                    <td>${emp.employeeName}</td>
                    <td>${emp.accountName}</td>
                    <td>${emp.phone}</td>
                    <td>${emp.email}</td>
                    <td>
                        <input id="${emp.employeeName}" name="${emp.empNo}" type="button" class="clickbutton1" value="通过"/>
                        <input id="${emp.employeeName}" name="${emp.empNo}" type="button" class="clickbutton2" value="删除"/>
                    </td>
                </tr>
            </c:forEach>
        </table>
    </div>
    </div>
    <div class="page-footer">
        <hr/>
        更多问题，欢迎联系<a href="mailto:webmaster@eeg.com">管理员</a>
        <img src="${pageContext.request.contextPath}/images/footer.png" alt="CoolMeeting"/>
    </div>
    <script>
        //console.log($);
        let $clickbutton1 = $(".clickbutton1");
        let len1 = $clickbutton1.length;
        //console.log(len);
        for (let i = 0; i < len1; i++) {
            //console.log($clickbutton1[i]);
            $clickbutton1[i].onclick = ()=>{
                alert($clickbutton1[i].id+" 审批通过！！！");
                $.post("pass.do?empNo="+$clickbutton1[i].name,
                    (data)=>{
                        //console.log(data);
                        if (data==1){
                            $clickbutton1[i].disabled = true;
                        }
                    }
                )
            }
        }
        let $clickbutton2 = $(".clickbutton2");
        let len2 = $clickbutton2.length;
        for (let i = 0; i < len2; i++) {
            $clickbutton2[i].onclick = ()=>{
                alert($clickbutton2[i].id+" 删除成功！！！");
                $.post("delete.do?empNo="+$clickbutton2[i].name,
                    (data)=>{
                        //console.log(data);
                        if (data==1){
                            $clickbutton2[i].disabled = true;
                        }
                    }
                )
            }
        }
    </script>
</body>
</html>
